package com.yushu.common.util.random;

public class Random {
    public static String Random(){
        char[] ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray();
        java.util.Random r = new java.util.Random();
        int len = ch.length; // 设置随机数取值的范围
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 8; ++i) {
            int index = r.nextInt(len);
            sb.append(ch[index]);
        }
        return sb.toString();
    }
     public static String ToRandom(int random){
        char[] ch = "0123456789".toCharArray();
        java.util.Random r = new java.util.Random();
        int len = ch.length; // 设置随机数取值的范围
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i <random; ++i) {
            int index = r.nextInt(len);
            sb.append(ch[index]);
        }
        return sb.toString();
    }

    public static String Random(int random){
        char[] ch = "abcdefghijklmnopqrstuvwxyz0123456789".toCharArray();
        java.util.Random r = new java.util.Random();
        int len = ch.length; // 设置随机数取值的范围
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i <random; ++i) {
            int index = r.nextInt(len);
            sb.append(ch[index]);
        }
        return sb.toString();
    }
}
